This document contains important information about the Extended Calculator II, please read it carefully. The document is intended for reading with the program Document Reader. It can be read by other applications as well, but then you will not be able to take advantage of Document Reader's unique navigating capabilities.
This document should ALWAYS be distributed together with the Extended Calculator II.
1. General Instructions
1.1. About this program
The Extended Calculator II was written by Niklas Frykholm using THINK C and CodeWarrior. The program is based on Extended Calculator, also by Niklas Frykholm, but has been rewritten almost entirely to be given more power and flexibility.
This program is ShareWare, so feel free to copy it and give it to your friends. However, if you use it and enjoy it you have to pay a small registration fee.
From now and on this program, and all my other programs are distributed as the Niklas Frykholm ShareWare package. By paying at least $5 you will be entitled to use, not only this program, but every ShareWare program that I have ever written, and that I will ever write in the future. This includes MacSnails, MacPatience, DocumentReader, CreatorChanger, BattleTanks, Extended Calculator II, Electric Poet, SimpleCard, HTML Pro, OrgaNicer, etc.
Note that $5 will only buy you a nominal registration. If you want a disk with the latest version of the package, send at least $10. If you have access to Internet, you will get new versions by e-mail and you can always pick up the latest version at my home page.
Why am I doing this? Partly it is so that those people who do pay their ShareWare fees, will not have to be ruined, partly so that those people who don't pay their ShareWare fees will realize how good an offer this is and start paying them.
Being a ShareWare writer does not necessarily mean being swamped in admirers' letters. (I should have become a heavy metal singer, as my mother advised me to.)
So please send $5 or a corresponding amount in the currency of your choice, together with your name and address and any other important facts, that you think I should know, to:
Niklas Frykholm
Rothoffsv. 37 A
S-903 42 Umeî
Sweden
nisfrm95@student.umu.se
http://www.ts.umu.se/~r2d2/
1.2. How to use it
This program is designed to be fairly simple to use for the layman (and still be more powerful than the pitiful excuse for a calculator that is shipped with the system). Yet the program offers advanced features, like graph-drawing and even its own programming language for the more experienced user.
The program calculates its result from an input string, which can be entered by clicking on the appropriate keys on the calculator or by simply typing it in. The program has been supplied with some intelligence, so it will realise that 3(2+1)+3sin3-1 means 3*(2+1) + 3*sin(3) - 1. This may however lead to some ambiguities, since in some cases, without parentheses there is really no way of knowing exactly what the user meant.
For example if the user has typed 2*-x^2, did he/she/you mean 2*(-x)^2 or 2*(-(x^2)). When the user typed e^-x^2, did he/she/you mean e^(-(x^2)), (e^(-x))^2, or e^((-x)^2). If you suspect that your input string contains expressions like these, always include parentheses to make it exactly clear what you are meaning.
The notation used by this calculator comes from the following sources:
1. Mathematics: + - / * ! ├ ╔
2. Basic: ^ rnd <> ╔
3. Pascal: = := ╔
4. C: && || & | % \ ╔
5: My own mind: *' +' -' /' ╔
1.3. How to learn using the calculator
Start by opening the Calculator application. Select Layman's calculator from the Calculators menu. Try clicking on the keys and typing in expressions, until you have an idea of how it works. When you think you have got the hang of it, open the Scientific calculator.
The scientific calculator has a number of keys, that covers much of what you can do with the calculator. Apart from the ability to click a key instead of typing an expression, these keys can be useful as a reminder, when you have forgotten exactly what functions were available.
If you are curious and want to learn more, turn to this manual. It contains a full description of each one of the calculators, the entire set of functions that the calculator supports together with a thorough description of all the errors displayed by the calculator.
Many times a concept which applies to many calculators is only mentioned in the "simplest" calculator in which it occurs. For example, how to enter an expression is only mentioned in the Layman's Calculator section.
If you are unsure of the concept of a function it might be useful to check out the function glossary in the function reference part of this manual.
If you want to learn how to use the calculators built-in programming language to create your own programs, you should check out the section on the Programmable calculator in this manual. You should also browse through the entire set of functions, so that you have an idea of which tools are available to you. If you still have trouble grasping the concept of programming (which in fact is not so different from calculating), I suggest you get hold of a beginners book on programming. Many of the concepts of the Extended Calculator's programming language are similar to those of Basic, Pascal, and C.
1.4. General editing instructions
In general, you will use either the keyboard or the mouse to enter an expression. As you type (or click) the expression will appear in a text box. By pressing the return key on the keyboard you will tell the computer to evaluate the expression.
This calculator does not work like the simple credit-card calculators. If you type "3 * 2 +" on such a calculator, the expression "3 * 2" will be evaluated in the instant that you press the "+" key, resulting in a "6" in the display window. The Extended Calculator will not calculate any part of the expression until you press the return key.
1.5. Using multiple calculators
This program offers not one, but four separate calculators, this makes it possible for the program to offer both simplicity and power as well as a wide range of different functions.
You open a calculator by choosing its name from the Calculators menu. All the calculators can be open at the same time. You select the calculator you want to work with by clicking its window or selecting its name from the Calculators menu.
It should be noted, that the four Calculators should be considered only as different interfaces to the same set of data and functions. Thus, it is possible to write a program using the Layman's calculator, it will be an awesome task, though, since its interface wasn't designed for that purpose.
At any given time, you should use the one of the four calculators that seems to make the most sense, considering the particular problem you are trying to solve.
2. The Menu Options
2.1. The Apple menu
About The Extended Calculator
-----------------------------
This option shows a nice picture with some information about the program.
2.2. The File menu
Close
-----
Selecting Close from the File menu closes the frontmost window.
Quit
----
Selecting Quit from the File menu will, as usual, terminate the application.
2.3. The Edit menu
Undo, Cut, Copy, Paste, Clear
-----------------------------
These options works as usual, with the exception that most of the time, Undo is not available. I know leaving out the Undo command isn't very Macintosh, but as I use to say, I'm a shareware writer, not the Microsoft corporation.
2.4. The Calculator menu
This menu enables you to select between the various calculators supplied by this program. You simply pick the calculator you want to work with from the menu. If the calculator's window is closed it will be opened, otherwise it will just be brought to front.
2.5. Calculator specific menus
In addition to the menus described above, each calculator may also have one or more menus of its own. (Menus that only appear when that calculator is active.) For information about those menus, I refer to the sections dealing with each one of the calculators.
3. The Layman's Calculator
3.1. The window
The window of the Layman's calculator contains a box where the calculations together with their results appear and a total of twenty keys. You can use the box as a normal text edit field, that is, you can type in an expression, use the mouse to select parts of it, cut, copy and paste, just as you are used to from any word processing application.
If you don't want to use the keyboard, you can use the mouse to click on the keys of the calculator. Clicking a number or the period will make that number appear in the display box. Clicking ( ) ├ * + - or ╓ will make the appropriate symbol appear in the display window. If you press ╓, the / symbol will appear, because this is the preferred symbol for division. (However, if you use the keyboard to type ╓, the computer will understand that this also is an expression for division.)
The key labeled EXP is used for entering very large or very small numbers using scientific notation. When you press the key EXP the capital letter E will appear in the display window. This E should be thought of as the *10^ you use when you write numbers in scientific notation. Thus 1E3 is the same as 1000 and 12E-3 is the same as 0.012. Note that although you can think of E as short for *10^, the letter E can only be used for entering numbers in scientific notation, not for a general calculation involving *10^. Expressions like 1E2.5 or 1E(2+3) will not be interpreted as 10^2.5 and 10^(2+3), but instead as 1E2 = 100 and 1E2 + 3 = 103 respectively. Also note that only the capital E can be used for this purpose, e is a symbolic constant ┼ 2.7182.
The key labeled = is as usual used for triggering the calculation. The same result can be obtained by pressing the return key in the display box. Note that pressing the = key on the keyboard will not produce this result, but instead result in a = in the display box. This is because the calculator uses = as a logical operator. (For an explanation see the functions reference, section 7.8) This may seem confusing, but on most simple calculators pressing the key = means "evaluate the expression", and I didn't want to interfere with this. If you are using the Scientific Calculator you will find that the key that means "evaluate the expression" is labeled as a return key. This is because the Scientific Calculator is aimed toward more advanced users.
3.2. Entering an expression
As mentioned several times earlier there are basically two ways of entering an expression. You can use the keys on your keyboard or you can click on the keys displayed in a calculator's window. Which one to prefer is a matter of taste, although using the keyboard usually is faster. There is also the possibility of pasting in an expression from another program (or from this manual) directly into the display box.
There might be a difference between the Layman's Calculator and the calculator you are used to. Most simple calculators perform operations directly. If you press 9 and then the square root key the calculator will instantly calculate ├9 and display the result 3 in its display window. This calculator will however gather the keystrokes to an input string (which will be displayed in the display window) and not perform any calculations until you order it to (by pressing the = key on the calculator or the return key on your keyboard).
This means that if you press 9 and then the square root key the computer will display 9├, this is probably not what you intended. Pressing the ├ key first and then the 9 key will give the correct result ├9.
You use the parentheses to delimit parts of the expression that will be calculated before other parts. If you write 9*3+2 the calculator will multiply 9 by 3 and than add 2. By convention an expression with * will always be calculated before an expression with +. * is said to have higher operator precedence than +. (^ has still higher precedence so if you write 2*2^3 the computer will raise 2 to the power of 3 and then multiply the result by 2.) Suppose that this is not what you wanted. Suppose that you wanted to first add together 3 and 2 and then multiply the result by 9. In this case you would put 3 + 2 in parentheses to get the expression 9*(3+2) which will evaluate to 45, the result you wanted.
3.3. Using the results of calculations
When you need to use the result of a calculation, for example in a word processing document, you can type it of from the calculators window. A better method is sometimes to use the standard Cut, Copy and Paste commands provided by most Macintosh applications. Select the result you want to use and choose Cut or Copy, then switch to the word processing program and choose Paste.
4. The Scientific Calculator
4.1. The window
The Scientific calculator contains two display windows and two keyboards, one with big keys in the right half of the calculator, one with smaller keys in left half.
The upper window is used for entering expressions to be evaluated. The results of the calculations or any errors that occurred while calculating will be displayed in the lower window. If you enter an expression in the lower window and try to calculate it you won't get any result.
Clicking one of the calculator's keys will make the expression corresponding to the key appear in the display window, at the position of the caret. For a description of the different functions provided by the calculator I refer to the Functions reference part of this manual, section 7.
The expressions that appear when you press a key will not always look as the label of the key. Pressing "EXP" will display "E", pressing the key labeled something like "y├x" will display "^(inv(". (The reason for this is that the ├ sign is only used to evaluate square roots so 3├27 would not be interpreted as the third root of 27, which is 3, but instead as 3 times the square root of 27, which is 15.58.) So don't be surprised if the expressions displayed does not adhere to the letter of the label, they will in all cases adhere to its spirit.
When you press the key corresponding to a function with only one argument, only the function name will appear. Pressing the sin key will display "sin". However, when you press the key of a function taking several arguments, dummy arguments will appear. For example pressing the round key, will display: "round(x, noDecimals)". The reason for this is that when a function takes several arguments it could be painful to try to remember their order (should the number of decimals go before the value I was rounding off or should it go after?). The dummy arguments should of course be replaced with the real expression you want to evaluate. If you try to evaluate round(x, noDecimals) directly, you will get an error, since the calculator doesn't know of the word "noDecimals".
4.2. Using complex numbers
While the Scientific Calculator does not fully support complex numbers (for example, it does not support raising a complex number to an arbitrary exponent or raising e to an arbitrary complex number) it is able to perform some simpler operations on them. (Adding, subtracting, multiplying, dividing, calculating their absolute and congruent values, their real and imaginary part.) This entry will only describe how complex functions are used on this calculator, not the functions themselves. For a description of those I refer to the Function Reference section, part 7.2, of this manual.
A complex number consists of a real and an imaginary part. In ordinary mathematics complex numbers are written 2 + 3i, 4 - 5i and so on, where i is the imaginary unit ├(-1). The Extended Calculator does not support this use of i (in the Extended Calculator i is one of the 25 single letter variables). A complex number in the Extended Calculator is instead written (real_part, imaginary_part). The numbers above would thus be written (2,3) and (4,5).
The complex arithmetic functions look like their real value counterparts but are followed by an apostrophe '. Thus to use the Extended Calculator to calculate (2+2i)/(-2-i) you would write. (2,2)/'(-2,-1), with the result (-1.2, -0.4).
Note that only the Scientific Calculator can display complex numbers as the result of a calculation. If you use the Layman's calculator only the real part of the complex number will be displayed. Therefore, when you are fiddling with complex numbers, stick to the Scientific Calculator.
4.3. Using variables
If you have used the M, RM, M+ and M- functions on an ordinary calculator, you are already familiar with the concepts of variables. A variable is a place where you store the result of a calculation to later retrieve it for use in another calculation. In this sense a variable may be thought of as a container with place for a number.
4.3.1 Variables available
-------------------------
The Extended Calculator offers two types of variables. The first are the absolute variables a - z. Each one of the single lowercase letters from a to z (except e which is used as the base for the natural logarithm, e ┼ 2.718╔) gives access to a separate storage place for a number. The other is the indexed variable provided by the function mem(x). This function acts as a different variable for every value of x, as long as x is between 0 and 99. Thus, mem(2) is one variable and mem(3) another. The function mem(x) gives you access to 100 different variables, each which may contain it's own number. If you write mem(101), you will get an error, because only 100 storage places are reserved for the function mem(x).
4.3.2 Storing something in a variable
-------------------------------------
You store a value in a variable by using the assignment operator :=. You write the variable on the left side of the assignment operator and the value you want to assign to the variable on the right side. Here are some examples of assignment statements:
a:=sin(╣) ^ 2
mem(37):=2 ^ (3 + 3 cos (1/2))
Trying to assign a value to something which is not a variable (2 := 1 +1) will generate an error.
4.3.3 Using a variable's value
------------------------------
To use the value stored or put in a variable, simply use the variable's name in the calculation. Examples:
cos(mem(37))
sin(a)^mem(37)
a:=a+1
mem(mem(1)):=y^(mem(x))
Try to understand what each one of these statements actually does.
4.4. Doing multiple calculations
The facility that makes the Scientific calculator able to display complex numbers in its lower display window also makes it possible to calculate a number of expressions at the same time, displaying all the results simultaneously in the result window.
To use this facility, simply separate each calculation with the comma delimiter, for example, writing "2+3,2*3" and pressing return will make the result "(5, 6)" appear in the lower window.
4.5. Using reverse polish notation
Reverse polish notation (usually abbreviated RPN) is a method for writing any expression without the use of parentheses. A thorough explanation of the concept of RPN is given in the Technical Reference section, section 10, of this manual.
The Extended Calculator converts the expression you type to RPN before evaluating them, the reason for this is that while ordinary notation might be more natural to you, RPN is more natural to the computer. Because of this, there is usually no need to write an expression in RPN, ordinary notation is generally superior. There might however be a rainy day when you want to try RPN for experimental purposes or just for the sheer fun of it.
To write an expression in RPN with the Scientific calculator all you have to do is to separate each element with a comma, thus if you wanted to calculate 5^((3+2)*4) using RPN you would simply write:
3,2,+,4,*,5,^
Well, maybe not so simple, but isn't it FUN?
5. The Graph Drawer
5.1. The window
The window of the Graph Drawer is automatically redrawn in the background when you remove some element in the foreground so that other parts of the Graph Drawer's window show up. Since some graphs take quite a time to plot, this may cause a disturbing delay. To avoid this, don't have the Graph Drawer running in the background while using another calculator.
The window of the Graph Drawer contains the following elements:
The graph window
----------------
This is where the graph will be displayed. It contains one or two graphs together with the x- and y-axis and occupies most of the Graph Drawer window.
The scroll arrows
-----------------
There are four scroll arrows to the left and to the right of the graph. These are used for scrolling the graph vertically and horisontally. For more information about scrolling see section 5.6 on Zooming and scrolling.
The origin button
----------------
The origin button is placed in the lower right corner of the graph. It looks like a plus sign. Pressing the origin button will take you to the default view, which is the view that is used when the Graph Drawer is opened. This default view is centered about the origin with x ranging from -10 to 10 and y ranging from -5 to 5. You can change the default view using the Set Default View menu option, see section 5.2.
The zoom in button
------------------
The zoom in button is situated in the lower right corner of the graph. It looks like a sine curve in close-up. Clicking it will zoom in on the center of the graph. Zooming is more thoroughly described in section 5.6 on Zooming and scrolling.
The zoom out button
-------------------
The zoom out button is just to the left of the zoom in button and looks like a sine curve. Clicking it will zoom out. For more information see section 5.6 on Zooming and scrolling.
The zoom to selection button
---------------------------
The zoom to selection button is situated just above the other two buttons. Zooming is more thoroughly described in section 5.6 on Zooming and scrolling.
The graph specific controls
---------------------------
Below the graph window are a number of controls. The appearance of these controls is specific to each one of the graphs and is therefore described in the section on each of the graphs.
The current coordinate display
------------------------------
In the lower left corner of the Graph Drawer's window is a coordinate displayed. This coordinate is the coordinate corresponding to the current mouse position. You can move the mouse to parts of the curve to find out their coordinates. This is useful, for example for finding approximate max and min values.
5.2. The Graph menu
Set Range
---------
Set Range brings up a dialog box which allows you to specify which part of the graph you want to view. You type in the minimum and maximum values of x and y that you want to use and press OK.
Zooming Options
---------------
Zooming Options brings up a dialog box that let's you specify how the different zoom buttons will work. For more information about this see section 5.6 on Zooming and scrolling.
Set Default View
----------------
Set Default View will select the current view as the default view. If you zoom in, out and scroll, you can always return to the default view by pressing the cross-hair control in the lower right corner of the graph window.
Same Scaling x/y
----------------
After you have zoomed to a selection several times the graph may be stretched or compressed horisontally or vertically, if the zoom window didn't have the same shape as the graph window. Choosing this menu option will correct this problem by forcing the same scaling upon the x- and y-axis.
Copy Graph
----------
Selecting this option will put a copy of the graph in the clipboard. The copy can be pasted into a word processing program or a drawing program.
Find Intersection
-----------------
For more information about this option see the separate section on finding intersections, 5.7.
Numerical differentiation
--------------------
This option is described in section 5.8.
Numerical integration
---------------------
This option is described in section 5.9.
Normal
------
This option allows you to draw ordinary graphs, see section 5.3.
Polar
-----
This option allows you to draw polar graphs, see section 5.4.
Parametric
----------
This option allows you to draw parametric graphs, see section 5.5.
5.3. Ordinary graphs
An ordinary graph consists of all pairs of points (x,y) that solves an equation of the type y=f(x). Each value of x is associated with one value of y.
The ordinary graph drawer can draw two graphs, one consisting of all points (x,y) that solves the equation y=f(x) and one consisting of all points (x,z) that solves the equation z=g(x).
The ordinary graph window has two boxes where you can enter the two functions that will be plotted. The entries should be of the type y:=f(x) and z:=g(x), where f(x) and g(x) are the two functions you want to plot. If you want to plot a sine curve and a cosine curve at the same time, you would write "y:=sin x" in the upper box and "z:=cos x" in the lower box.
The ordinary graph window also contains a check box labeled Shadow if undef. Some functions are not defined for all values of x. For example ├x is only defined as a real number when x is positive or zero. Normally the graph drawer will simply skip the parts of the graph that are undefined, selecting this option will instead make the graph drawer shadow those parts of the graph, making it easy to see exactly the parts that are undefined. If a function is undefined in specific singular points (like 1/sin x), the Graph Drawer will usually fail to detect these points, this is because detecting such points requires a thorough examination of the functions involved, using calculus.
5.4. Polar graphs
A point in the plane can be specified by the ordinary rectangular coordinates (x,y), x being the perpendicular distance from the y-axis and y being the perpendicular distance from the x-axis. Another way of specifying a point in the plane is by the distance from the function to the origin and the angle that a line from the point to the origin makes with the positive x-axis. If you plot all the points satisfying the equation r = f(t), where r is the distance from the origin to the point and t is the angle a line from the point to the origin makes with the positive x-axis you will get a polar curve. Thus, r = 2 would represent a circle of radius 2.
The polar curve window has a box which let you specify which equation you want to use. You enter the equation as r := f(t), where f(t) is the polar function you want to plot. For example to draw a spiral you could write "r := ├ t" in the box.
The three boxes below are used to control which part of the curve is drawn and how carefully. An ordinary graph has only one point for each x-value so when you are drawing it you only have to step through each x-value in the graph window and plot the corresponding y-value. A polar graph may however loop back into itself, making it hard to determine which parts of the graph that will end up in the graph window. (Consider the graph r := 1/t close to the origin.) Therefore, there must be some way of determining which parts of the graph will be drawn.
t-min is the first value for which the function will be plotted, t-max is the last value and Steps is the number of measurements that will be taken along the path. Usually t-min will be 0 and t-max 3.14 or 6.28. Note that you cannot enter an arithmetic expression (such as 2╣) into these boxes, only numbers will do. The larger the number of steps you use the longer it will take to draw the curve, but the less jagged it will be.
If you have specified an enormous number of steps and the time it takes to draw the graph becomes unbearable, you can interrupt the process by holding down the command key and pressing the period (.) or by pressing the escape key. This will interrupt any calculation the Extended Calculator is busy with.
Note that although the Graph Drawer makes use of polar coordinates when drawing a polar graph, the coordinates displayed in the lower left part of the window will still be rectangular coordinates.
5.5. Parametric graphs
A parametric graphs consists of all the points (x,y) in the plane satisfying x = f(t) and y = g(t) for some value t. Specifying separate values for x and y allows you to draw complex functions, like conic sections, easily. Often a useful way of thinking of parametric graph is to imagine t being a variable representing time (although this is by no means necessary). The graph will then be the path traced out by a point traveling so that its x-coordinate at any given time t is f(t) and its y-coordinate at any given time t is g(t).
In the box of the parametric equation you enter the two equations for x and y separated by a semi-colon. Thus entering "x := 2 cos t; y := 2 sin t" will produce a circle of radius 2.
As with the polar graph (and for the same reasons) the three boxes below are used for determining which parts of the graph that will be drawn and with what accuracy. If we use the time-analogy again, this specifies between which times the path of the particle will be traced and how many samples of the particle's position that will be taken along the path.
5.6. Zooming and scrolling
To specify which part of a graph you want to look at you use the zooming and scrolling options to set the x-min, x-max, y-min and y-max of the graph window.
The most direct way do this is by selecting Set Range from the graph menu, this however, requires that you know exactly what part of the graph you want to look at, and even then it is not always the fastest option.
The scrolling arrows allow you to scroll along the graph to see how it changes. Since scrolling of the graph requires the graph to be redrawn, scrolling graphs often appears sluggish. Scrolling an ordinary graph vertically or scrolling polar or parametric graphs is often especially slow, since it requires the entire graph to be redrawn. Although slow, scrolling may still be useful under some circumstances.
The default view button, next to the down and right scroll arrows, which resembles a + will take you to a default view. When you start up the application this default view will be set to x ranging from -10 to 10 and y ranging from about -5 to about 5. You can however change the default view by specifying a new default view in the Zooming Options dialog, or choosing the Set Default View option when you have a pleasing view.
The zoom in button (resembles a sine curve in close-up) will zoom in towards the center of the graph. The default zooming is set to 200 %, you can however change this by using the Zooming Options dialog.
The zoom out button (resembles a sine curve) will zoom out of the graph. The default zooming is set to 25 %, but can be changed using the Zooming Options dialog box.
The zoom to selection button (above the other zoom buttons) zooms in to a part of the graph that you have selected. You select a part of the graph by dragging with the mouse (a flashing rectangle will appear). Clicking the zoom to selection button will zoom in so that the part you selected covers the entire graph window.
If you have used the zoom to selection button or the Set Range option you may have stretched the graph in some direction (so that a line making 45í with the x-axis in the actual graph will make another angle with the x-axis in the drawing in your window). Sometimes this doesn't matter, but sometimes you want to use the same scaling on the x- and y- axis. Selecting Same Scaling x, y will take care of this.
5.7. Finding intersections
When you are using the ordinary graph drawer and have two graphs in the same window you can use the menu option Find Intersection, to find a point where the two graphs intersect. Note that you cannot use this to find the point where a graph intersects one of the coordinate axis, unless you set one function to be y := 0.
To find the intersection of two curves, drag with the mouse to select the part where the two curves intersect and select Find Intersection from the graph menu. The Graph Drawer will use the bisection method to find the point where the two curves intersect. If the two curves do not intersect in the selection you have made or if they intersect more than once, you will get an error message.
5.8. Numerical differentiation
The Graph Drawer will automatically perform numerical differentiation on the graph for you. Select Numerical Differentiation from the graph menu and specify in which x-value you will differentiate (or in which t-value, for parametric and polar graphs) and the Graph Drawer will calculate a numerical derivative. If you have selected a part of the curve, the left limit of the selection will be used as a prompt in the differentiation dialog.
To do this it adds a tiny fraction to x, calculates y, then subtracts the tiny fraction from x and calculates a new y-value. It then divides the difference between the values with twice the tiny fraction.
For polar and parametric curves the numerical differentiation will not calculate dx/dt, dy/dt or dr/dt, but dy/dx in the point t, that is, the slope of the curve in that point.
5.9. Numerical integration
The Graph Drawer will automatically perform numerical integration for you. Select a part of the graph by clicking and dragging and select Numerical Integration from the Graph menu. This will bring up a dialog box, which lets you specify the integration limits and how many steps will be used for the calculation.
To calculate the integral, the calculator uses Simpson's formula for ordinary graphs and the trapezoid formula for polar and parametric graphs.
Note that for polar and parametric graphs the integral calculated is not ║x dt, ║y dt or ║r dt, but ║y dx when t ranges from the lower integration limit to the upper.
Note that if a parametric or polar curve goes in the negative x direction and y is positive this integral will be negative (since the differential dx will be negative).
6. The Programmable Calculator
6.1. The window
The window of the programmable calculator contains one big field which is used for entering the program, a scroll bar to the left for scrolling through the program, a size box in the lower left corner for adjusting the size of the window and an information bar at the bottom of the window.
The information bar displays how many memory units that are occupied by the program. There are 1000 units available. If you use up all these units, tough luck. A future version of the Extended Calculator might be able to run your program, but this one won't. It is worth saying once again that the Extended Calculator is intended for small programs for mathematical or humorous purposes (whichever comes closer to your heart), not for large scale programming. 1000 units is in fact sufficient for most programs you will want to write.
The information bar also displays the value of the common variables a, b, c, x, y, z. Sometimes it is convenient to store the results of a program in one of these variables and just reading the value from the information bar when the program is done, rather than bringing up a dialog box presenting the result.
6.2. The Programmable menu
Run
---
Run tells the computer to start executing the program beginning with the first line and continuing downwards. If the program seems to get stuck in an infinite loop or something, you can hold down the command key and press the period to halt program execution.
Open
----
Will open a previously saved program or any other text file and display the result in the programming window.
Save
----
Will save the program you are working on under it's current name. If it doesn't have one the standard dialog box will allow you to baptize and place it.
Save As
-------
Will bring up the standard dialog box for saving and allow you to enter a name and select a location where the program will be saved.
6.3. General editing instructions
You enter the program in the same way as you enter any text file. In fact, you can if you wish, use another editor than the Extended Calculator (such as your favorite word processing program) for entering the program, save it as a text file and then open it from the calculator.
One difference between this editor and the usual ones is that pressing the tab key in this editor will produce four spaces in a row. This is useful, since it is considered good programming style to indent the lines affected by a program flow controlling statement, such as below:
while (x<100);
x:=x+1;
beep;
end;
The Extended Calculator is case sensitive, but does not care about spaces or line feeds.
When you have finished editing the program, select Run from the Programmable menu and program execution will start. If the program gets stuck in a loop holding the command key and pressing a period (.) will halt execution.
6.4. Programming vs. calculation
Assuming you know how to use the Extended Calculator for ordinary calculations, how do you get started with programming? In fact the big difference between programming and calculating is not that big. A program may be considered simply to be a long calculation. Indeed, the Extended Calculator makes no difference between programs and other calculations, they are treated in exactly the same way. There are however three points worth mentioning on this issue.
a. A program contains more than one statement
---------------------------------------------
A statement should be thought of as an instruction to the computer, it is comparable to the sentence in ordinary languages . Ordinary calculations contain only a single statement, like sin(╣/6)^2, most programs will however contain several statements. The statements are separated by a semi-colon ;. Usually each statement begins a new line, although this is not necessary. Thus if you write:
sin (3);
2+6*12;
in the window of the programmable calculator and select Run, the computer will first calculate sin(3) and then proceed to the next line and calculate 2+6*12. Check out the sample programs to get a better idea of how this works.
b. A program makes use of variables
-----------------------------------
You may use variables in other calculations, but variables are (often) crucial to a program. If you have used an ordinary table calculator you will probably have made use of its memory functions (M, M+, M- and RM) to store and retrieve information. A variable may be thought of as one such memory location. The extended calculator gives you access to 125 such variables (through the letters a - z and the function mem). Each of these may contain a different value.
What makes variables crucial to programming is that whatever result one statement produces is lost when the computer proceeds to the next statement. If you run the sample program above, the computer will first calculate sin(3), it will then forget whatever the result of this calculation was and proceed with calculating 2+6*12, when that is done, it will forget the result and continue with the next statement, so this program won't do you much good. If you want to keep the results of a calculation you must assign them to a variable. After running the program:
a:=sin(3);
b:=2+6*12;
the variable a will contain the value of sin(3) and the variable b will contain the value of 2+6*12.
c. A program uses functions to control program flow
Normally a program is executed line by line from the top to the bottom. Sometimes, however, this is not what you want. You may want the computer to perform a certain task repeatedly 200 times or you may want it to perform different tasks depending on the values of a variable. In these cases there are functions that let you control program flow. The space here does not allow for an explanation of the different kinds of control statements. Check out section 6.6 for a description of this.
6.5. Using variables
A variable may be thought of as a memory location, or to be more physical, as a container where you can store a number. You can store the result of a calculation in a variable and retrieve it later to make use of it in another calculation.
6.5.1 Variables available
-------------------------
The Extended Calculator offers two types of variables. The first are the absolute variables a - z. Each one of the single lowercase letters from a to z (except e which is used as the base for the natural logarithm, e┼2.718╔) corresponds to a certain location in the memory. The other is the indexed variable provided by the function mem(x). This function acts as a different variable for every value of x, as long as x is between 0 and 99. Thus mem(2) is one variable and mem(3) another. Thus, the function mem(x) gives you access to 100 different variables, each which may contain its own number. If you write mem(101) you will have an error, because mem only gives access to 100 memory locations.
6.5.2 Storing something in a variable
-------------------------------------
You store a value in a variable by using the assignment operator :=. You write the variable on the left side of the assignment operator and the value you want to assign to the variable on the right side. Here are some examples of assignment statements:
a:=sin(╣) ^ 2;
mem(37):=2 ^ (3 + 3 cos (1/2));
Trying to assign a value to something which is not a variable (2 := 1 +1) will generate an error.
6.5.3 Using a variable's value
------------------------------
To use the value stored or put in a variable, simply use the variables name in the calculation. Examples:
cos(mem(37));
sin(a)^mem(37);
a:=a+1;
mem(mem(1)):=y^(mem(x));
Try to understand what each one of these statements actually does.
6.6. Controlling program flow
The Extended Calculator usually executes a program line by line, but sometimes you want it to do different things depending on the value of some variable or to perform a certain task repeatedly until a certain condition is satisfied. To do this you use functions that control program flow.
The Extended Calculator uses only two functions for controlling program flow. This is for two reasons. 1) Keeping the functions to a minimum reduces confusion and developing time. 2) Anything that can be done with the program flow can be done with these two functions, it may require some extra thinking though.
6.6.1 The if - else - end construction
---------------------------------------
The if function lets you perform some statements depending on the value of a variable (or some other condition). In your program, the statement will look like this:
if (some condition);
lines that will be executed if the condition is true
else;
lines that will be executed if the condition is false
end;
It is possible to leave out the else statement and the lines following that (you must include the end, though, otherwise the computer won't know which lines are affected by the if-statement. A silly sample program using if might be:
x:=message("Is it OK to beep?");
if (x=1);
beep;
message("Nice beep, huh?");
else;
message("OK, I'll keep quiet!");
end;
6.6.2 The while-end construction
-----------------------------
The while end construction lets you execute some lines repeatedly while a certain condition is true. In your program it will look like this:
while (some condition);
some lines that will be repeated
end;
An even sillier sample program than the one in section 6.6.1 might be:
x:=message("Is it OK to beep?");
while(x=1);
beep;
x:=message("Wanna hear another beep?");
end;
6.7. Comparison of control functions
The Extended Calculator's supply of expressions controlling program flow is small, nevertheless, using only these simple expressions, most common control structures can be mimicked. In this section we will look at some control structures from other languages and see how to implement them with the Extended Calculator's code.
6.7.1 goto
----------
There is no thing similar to the goto statement in the calculator's language. However, there is no situation where a goto statement is absolutely necessary. Many common languages, like C and Pascal, lacks a goto statement or discourages the use of it, since it often leads to bad programming style. If you are unsure of how to program without using goto, check out a primer on C or Pascal.
6.7.2 gosub, functions
----------------------
This program does not allow subroutines or the declaration of functions or procedures. If this was a program intended for writing big applications, this would of course be a major flaw. This program is however intended for small-scale programming, which is quite possible without the declaration of functions. Anything that normally would have been a function you will have to type out to its full length everywhere it would be used.
6.7.3 else if
-------------
This program does not have an else if statement. You can however easily write code that behaves exactly like such a statement, for example:
if (a);
(do something);
else if (b);
(do something else);
end;
would in the language of the Extended Calculator be written as:
if (a);
(do something);
else;
if (b);
(do something else);
end;
end;
or maybe as:
if (a);
(do something);
end;
if (not(a) && b);
(do something else);
end;
6.7.4 switch, case
------------------
The switch and case statements in C and Pascal (somewhat similar to the ON x GOSUB statement in Basic), can easily be emulated using a series of if-statements.
switch(x) {
case 1:
doSomething;
break;
case 2:
doSomethingElse;
╔
would be written as:
if (x=1);
doSomething;
end;
if (x=2);
doSomethingElse;
╔
6.7.5 for, next
---------------
A for-next statement can be simulated using the while construction, for example╔
for (x=1; x<10; x++)
doSomething;
would be written as
x:=1;
while (x<10);
doSomething;
x:=x+1;
end;
6.8. Getting data from the user
If you want a program to be flexible you must have some way of getting data from the user, data that you later can use in the program.
6.8.1 Getting Data From Dialogs
-------------------------------
message ("some text")
The message functions provides a way of getting simple validation (OK or Cancel). Calling message() will bring up a dialog with the text between the quotation marks. If the user clicks OK the function will return 1, if the user clicks Cancel it will return 2. The function show() (described in section 6.9.1) can be used in a similar fashion.
if (message("OK to beep")=1);
beep;
end;
get ("some text", number)
This function is useful if you need the user to input a number. Calling get() will bring up a dialog displaying the text within the quotation marks. The number sent to the function will be displayed as a prompt in a box, where the user can enter a number. The function will return the number the user has entered.
w:=get("What is your weight in kilos",72);
6.8.2 Getting Data From The Mouse
---------------------------------
HMouse
This function will return the horizontal position of the mouse relative to the top left corner of the window.
VMouse
This function will return the vertical position of the mouse relative to the top left corner of the window. Unlike what you may be used to a higher number means the mouse is closer to the bottom of the screen.
button
This function will return 1 if the mouse button is being pressed and 0 if it is not being pressed.
6.9. Displaying data to the user
There are several ways of displaying data to the user. The simplest way is to store the value you want to display in one of the variables a, b, c, x, y and z, the user can then easily read the value from the information bar when the program has ended.
6.10. Presenting data in dialogs
--------------------------------
show ("some text", value)
This function will bring up a dialog box displaying the text within the quotation marks immediately followed by the value. If the user clicks OK the function will return 1, if he clicks Cancel it will return 2. This function is useful for displaying a single number as the result of a calculation, or as a way of getting data from the user. (See 6.8 Getting data from the user). If you just want to display a message and no value use the function message. (See Getting data from the user.)
show ("The sine of 3 is: ",sin 3);
6.11. Presenting data in a graphic window
-----------------------------------------
The Extended Calculator can bring up a graphic window where text, numbers and various graphic objects can be drawn. The functions for handling graphics are quite many and I refer to the sections Drawing 7.4, Printing text and numbers 7.11 and Window functions 7.17 of the Function Reference part of this manual, here I will just explain some of the functions.
text ("some text", left, top, right, bottom, alignment);
Draws the text within the quotation marks in the box determined by the coordinates. Alignment should be 0 - left alignment, -1 right alignment or 1 - center. You can use the functions TFont, TFace, TSize and TMode to determine the appearance of the text that will be drawn.
text ("You guessed right!",20,20,100,100,1);
drnu (value, left, top, right, bottom);
This function is similar to text, the difference is that it draws a number instead of text. It draws the number value in the box specified by the coordinates. The functions TFont, TFace, TSize and TMode can be used to control the appearance of the text.
6.12. Sample programs
Here are some sample programs, which hopefully will help you understand the concepts presented in this section.
6.12.1 Guessing game
"(uses 93 memory units)"
a:=random(1,100);
h:=100;
l:=0;
x:=get("Guess a number between 1 and 100!",int((h+l)/2));
n:=1;
while (x<>a);
if (x<a);
l:=x;
x:=get("Wrong, guess higher!",int((h+l)/2));
else;
h:=x;
x:=get("Wrong, guess lower!",int((h+l)/2));
end;
n:=n+1;
end;
show("You finally got it right. Total number of guesses:",n);
6.12.2 Mirror drawer
"(uses 91 memory units)"
a:=HMouse;
b:=VMouse;
while(not(button));
PPat(random(1,5));
x:=HMouse;
y:=VMouse;
line(a,b,x,y);
line(600-a,b,600-x,y);
line(a,300-b,x,300-y);
line(600-a,300-b,600-x,300-y);
a:=x;
b:=y;
end;
7. Function Reference
7.1. Function glossary
Mathematically speaking a function is something that maps a set of input values (which may be real numbers, complex numbers or something you'd rather not hear about) to a set of output values.
In plain language a function works like the famous black box. You stuff something in one end and something pops out of the other end. The things you stuff in are usually enclosed in parenthesis after the functions name, sin(3), cos(2), but there are exceptions, like 2 * 3 or 4!.
In computer jargon the things that are stuffed in are called "arguments", and the arguments are said to be "sent to the function". Whatever pops out is said to be "returned from the function". When you write sin(x) the argument x is sent to the function sin, which returns the sine of x.
In a calculation the value of a function is the value it returns. If you write 2*sin(3), this might be read as: "2 times the value returned when the argument 3 is sent to the sine function", but why bother, when it is much simpler to say "2 times sine of 3".
Some functions (like PNormal) does not return any value, but instead, perform an action of some sort. Since such "functions" are not functions in the mathematical sense, some computer languages refer to them as procedures. Others, however, do not bother to make a difference.
7.2. Complex
(a, b) +' (c, d), (a, b) -' (c, d), (a, b) *' (c, d), (a, b) /' (c, d)
Note that a complex number is always denoted (a, b), the program does not make use of the imaginary unit i. You cannot write 1 + 2i, you must write (1, 2).
cabs (a, b)
The absolute value of the complex number a + bi.
cabs (3, 4) = 5.
con (a, b)
The congruent number to the complex number a + bi.
con (3, 4) = (3, -4).
im (a, b)
The imaginary part of the complex number a + bi.
im(3, 4) = 4.
re (a, b)
The real part of the complex number a + bi.
re (3, 4) = 3.
angle (x, y)
The angle the line from the origin to the point (x, y) makes with the x-axis.
radius (x, y)
The distance from the point (x, y) to the origin.
x-coor (radius, angle)
The x-coordinate of the point with polar coordinates (radius, angle).
y-coor (radius, angle)
The y-coordinate of the point with polar coordinates (radius, angle).
7.3. Dialogs
beep
Makes the computer beep.
get ("some text", number)
Displays the text "some text" in a dialog box and offers the user to input a number. The number passed to the function will be used as a prompt in the dialog box. The function returns the number the user types in the dialog box.
a:=get("Area of sphere:", 10).
message ("some text")
Displays the text "some text" in a dialog box. If the user clicks OK the function returns 1 if the user clicks Cancel, it returns 2.
g:=message ("Continue long calculation?")
show ("some text", a)
Displays the text "some text" together with the value a in a dialog box. If the user clicks OK the function returns 1, if the user clicks Cancel it returns 2.
Paints, Frames, Inverts or Erases an arc with the specified coordinates. The angles are measured in degrees. StartAngle is the angle where the computer will start drawing and angleSpan is the central angle of the arc. An angleSpan of 180 will produce a semi-circle, for example.
EArc (10, 10, 20, 20, 0, 90);
line (x1, y1, x2, y2)
Draws a line from the point (x1, y1) to the point (x2,y2).
line (10,10,100,100);
cls
Clears the drawing area.
PNormal
Sets the pen to the normal 1 x 1 pixel pen with black pattern.
PSize (h, v)
Sets the horizontal size of the pen to h and the vertical size to v.
PMode (x)
Sets the penmode to x. x must be one of the following values:
08 = copy the pen's pattern to the drawing
09 = or the pen's pattern with the drawing
10 = xor the pen's pattern with the drawing
11 = bic the pen's pattern with the drawing
12 = copy the pen's pattern to the drawing and invert
13 = or the pen's pattern with the drawing and invert
14 = xor the pen's pattern with the drawing and invert
15 = bic the pen's pattern with the drawing and invert
PenPat(x)
Sets the pen's pattern to x. x must be one of the following values:
1 = white
2 = light gray
3 = gray
4 = dark gray
5 = black
Color(red, green, blue)
Sets the pen's color to the specified RGB value. Possible values range from 0 to 100, so white is Color(100,100,100), black is Color(0,0,0) and yellow is Color(100,100,0).
7.5. Economic functions
fv (nper, amm, int)
Assuming you for nper periods pays the amount amm to a bank account or an other investment and that the interest has a grow factor of int for each period, this function calculates the future value.
If you are paying $5 each month to a bank account with 1 % interest per month, after 12 months you will have fv(12, 5, 1.01) on the bank account.
nper(fv, amm, int)
Assuming you are paying the amount amm each period to a bank account, and that the interest has a grow factor of int for each period, this function calculates how many periods required to achieve the sum fv.
You want to save $2000 by paying $20 each month to a bank account, to an interest of 1 % per month. This will take you nper(2000,20,1.01) months.
amm(fv, nper, int)
Assuming you make nper payments (one each period) to a bank account, with an interest grow factor of int each period, this function calculates the amount you have to pay each period if you want to have the amount fv by the end of the payments.
You want to save $2000 in 24 months on a bank account which pays 1 % interest per month. In that case, you will need to deposit amm(2000,24,1.01) each month.
7.6. Exponential functions
exp (x)
Returns e^x, where e is the base of the natural logarithm.
ln (x)
Returns ln(x), that is the natural logarithm of x.
lg (x)
Returns lg(x), the 10-logarithm of x.
log(base, x)
Returns the logarithm of x, with base as base.
7.7. Integer
com (n, k)
The number of combinations of n and k. The number of ways in which you can choose k elements of n if you are not concerned about the order, n! / (k! (n - k)!).
com (5, 3) = 5! / 2! 3! = 10.
per (n) or n!
The number of permutations of n. The number of ways in which you can arrange n elements.
per (4) = 1 * 2 * 3 * 4 = 24.
random (lowLim, upLim)
A random integer between lowLim and upLim.
random(1, 6) simulates an ordinary die.
7.8. Logical functions
x and y, x & y
Returns the bitwise and of x and y.
x or y, x | y
Returns the bitwise or of x and y.
~x
Returns the bitwise not of x.
not (x)
Returns the logical not of x.
x && y
Returns the logical and of x and y.
x || y
Returns the logical or of x and y.
7.9. Memory functions
a - z
The single letters a to z are used as variables. (With the exception of e, which is a constant ┼ 2,718╔). This means that they can be assigned values, which later can be used.
mem(x)
The function mem(x) provides access to 100 memory cells, which may be used as variables. The number x is an index that tells which of the 100 cells you are referring to. It should be in the range [0, 99].
7.10. Mouse functions
HMouse
The horizontal position of the mouse.
VMouse
The vertical position of the mouse.
button
Has the value 1 if the mouse button is currently being pressed and the value 0 otherwise.
7.11. Printing text and numbers
text ("some text", left, top, right, bottom, alignment);
Draws the text "some text" in the box with the specified coordinates and the specified justification. The alignment must be one of the following values:
0 - align left
-1 - align right
1 - center
drnu (a, top, left, bottom, right)
Draws the number a in the specified rectangle.
TFace(x)
Sets the text face to x, where x may be one of the following:
00 - plain text
01 - bold
02 - italic
04 - underline
08 - outline
16 - shadow
32 - condense
64 - extended
If you or-together several of these values all the styles corresponding to the values will be applied.
TMode(x)
Sets the transfer mode for drawing text to x, where x is one of the following:
1 - or the text with the drawing
2 - xor the text with the drawing
3 - bic the text with the drawing
TFont(x)
Sets the text font to x, the font numbers of some common fonts are:
00 - System font (Chicago)
01 - Application font (Helvetica)
02 - New York
03 - Geneva
04 - Monaco
05 - Venice
06 - London
07 - Athens
08 - San Francisco
09 - Toronto
11 - Cairo
12 - Los Angeles
20 - Times
21 - Helvetica
22 - Courier
23 - Symbol
24 - Mobile
TSize(x)
Sets the size of the text to x points.
7.12. Program flow
if (a); [some lines] end;
If a is true, the lines before the end-command are executed, if a is false, the lines are skipped.
if (x>3); message ("x is bigger than 3"); end;
if (a); [part1] else; [part2] end;
If a is true, part1 is executed, if a is false, part 2 is executed.
if (x>3); message ("x is bigger than 3"); else; message("x is smaller than 3"); end;
while (a); [some lines] end;
If a is true the program executes the lines and when it reaches the end statement, loops back to the while statement, thus the lines may be executed many times, as the program loops in the while statement.
while (x<100); x:=x+1; end;
stop
Stops program execution;
7.13. Real-value
abs (a)
The absolute value of a.
abs (-3) = 3.
arit(a, b, c)
The sum of the arithmetic series whose first term is a, second term is b and last term is c.
arit (1, 4, 16) = 1 + 4 + 7 + 10 + 13 + 16 = 51.
ceil (a)
The smallest integer that is bigger than or equal to a.
ceil (╣) = 4.
geom (a, b, c)
The sum of the geometric series whose first term is a, second term is b and last term is c.
geom (1, 2, 16) = 1 + 2 + 4 + 8 + 16 = 31.
int (a)
The largest number smaller than a.
int (3.5) = 3.
inv (a)
The inverse value of a.
inv (2) = 1/2 = 0.5.
limit(limit1, x, limit2)
If x lies between limit1 and limit2 this function will return x. If x is greater than the greater of the two limits, the function will return that limit. If x is smaller than the smaller of the two limits, the function will return that limit. This function is useful if you want to constrain a variable to a certain range. x := limit(0, x, 100).
max (a, b)
The greatest of the values a and b.
min (a, b)
The smallest of the values a and b.
pi or ╣
Constant that equals the ratio of the circumference of a circle to its diameter. pi ┼ 3.141╔
rnd
A random value between 0 and 1.
round (a, b)
a rounded off at the b:th decimal place.
round (╣, 2) = 3.14.
sgn (a)
The sign of a. -1 if a < 0, +1 if a >0.
sgn (-3) = -1.
The sgn function is normally not defined for 0, but for the sake of convenience, this program will use: sgn(0) = 1.
7.14. Sign functions
a + b, a - b, a * b, a / b
Ordinary addition, subtraction multiplication and division.
a % b
a modulus b, the rest you get when you divide a by b.
10 % 7 = 3.
a \ b
The integer part of the quotient a / b.
10 \ 3 = 3.
a ^ b
a raised to the power of b.
2 ^ 3 = 8.
├ a
The square root of a.
├ 9 = 3.
a!
The permutation of a.
4! = 1 * 2 * 3 * 4 = 24.
a < b, a > b, a <= b, a ▓ b, a >= b, a │ b, a <> b, a >< b
Comparing functions, has the numerical value 1 if the condition is satisfied, 0 otherwise. <= means "less than or equal to". <> and >< means "not equal to".
Parentheses are used to separate parts of the calculation.
3 * (2 + 3) = 15.
e
Constant, the base of the natural logarithm.
e ┼ 2.718╔
╣
Constant, the ratio of the circumference of a circle to its diameter.
╣ ┼ 3.141╔
E
Exponent, used when displaying numbers in scientific notation.
2.3E+4 = 23000.
Note that E should be thought of as a part of the number, and not as a function. That is, you cannot write 3E+x or 3E+(4+3). In these cases you must write 3*10^x and 3*10^(4+3), respectively.
,
Used for separating arguments to a function.
FRect (0, 0, 100, 100).
;
Used for ending a statement when programming.
x := 3;
7.15. Time functions
tick
The number of ticks (1/60ths of a second) since the system was last started up. The ticks can be used for timing by noticing the difference between the values returned by two different calls to tick.
7.16. Trigonometric
sin (x)
The sine value of x (in radians).
cos (x)
The cosine value of x.
tan (x)
The tangent value of x. tan (x) = sin (x) / cos (x).
cot (x)
The cotangent value of x. cot (x) = 1 / tan (x).
sec (x)
The secant value of x. sec (x) = 1 / cos (x).
csc (x)
The cosecant value of x. csc (x) = 1 / sin (x).
asin (x)
The arcsine value of x. sin (asin (x)) = x.
acos (x)
The arccosine value of x. cos (acos (x)) = x.
atan (x)
The arctangens value of x. tan (atan (x)) = x.
acot (x)
The arccotangent value of x. acot (cot (x)) = x.
asec (x)
The arcsecant value of x. sec ( asec (x)) = x.
acsc (x)
The arccosecant value of x. csc ( acsc (x)) = x.
sinh (x)
The hyperbolical sine of x.
cosh (x)
The hyperbolical cosine of x.
tanh (x)
The hyperbolical tangent of x. tanh (x) = sinh (x) / cosh (x).
Opens a window with the specified title and coordinates. The windowProc determines which type of window will be opened. It should be one of the following:
00 - document window
01 - dialog box
02 - plain dialog box
03 - alternative dialog box
04 - document without grow box
08 - document with zoom box
12 - document with zoom box but without grow box
16 - black title bar, rounded corner window
Close
Closes the program's drawing window.
Copy
This command will copy everything that has been drawn by the program since the last call to Copy and put the result in the clipboard. It can then be pasted to the Scrap Book or to a word processing program. This is useful if you have used the calculator to create some appealing graphics.
8. Formulas
This section of the manual contains a variety of formulas from mathematics, physics, chemistry, &c╔ It is of course not possible to cover every formula and every topic, but I have tried to include the information I found most useful. The formulas are designed to be used together with the Extended Calculator, so they are written in the calculators native language. If there are functions in these formulas that you do not understand I refer to the functions part of this manual, where all functions supported by the calculator are described.
To use these formulas together with the calculator, select the formula that you need and copy it to the Extended Calculator, then replace the text in the formula with the known values.
8.1. Mathematics
Mathematical symbols used in this section:
+ Addition
- Subtraction
* Multiplication
/ : ╓ Division (any of these will do)
├ Square root
^ Power
! Permutation
\ Integer division
% Modulus
&& Logical and
& Bitwise and
|| Logical or
| Bitwise or
> Greater than
< Smaller than
= Equal to
│ >= Greater than or equal to
▓ <= Smaller than or equal to
¡ <> Not equal to
<=> Equivalence
=> Implicates
8.1.1 Fundamental algebraic laws
a + b = b + a
a * b = b * a
(a + b) + c = a + (b + c)
(a * b) * c = a * b * c
a * (b + c) = a * b + a * c
a + c = b + c <=> a = b
a * c = b * c <=> a = b if c ¡ 0
8.1.2 Approximations
Ñ The error in an approximation is the difference between the approximation and the real value.
Ñ A number f is said to be an error approximation if the absolute value of the error is less than or equal to f.
Ñ The relative error is the quotient of the error and the approximation.
Ñ The relative error approximation is the quotient of the error approximation and the approximation.
Ñ When adding or subtracting two approximations, the error in the result is not greater than the sum of the errors in the approximation.
Ñ When multiplying an approximation with a constant, the error in the result is not greater than the error in the approximation multiplied by the constant.
Ñ When multiplying or dividing two approximations, the relative error in the result is approximately equal to the sum of the relative error approximations.
Ñ Some useful approximations for small values of x are:
Ellipse with midpoint in origin and foci in (c,0) and (-c,0)
x^2/a^2 + y^2/b^2 = 1, where a^2 - b^2 = c^2
Hyperbola with midpoint in origin and foci in (c,0) and (-c, 0)
x^2/a^2 - y^2/b^2 = 1, where a^2 + b^2 = c^2
The asymptotes of the hyperbola are given by
y = bx/a and y = -bx/a
8.1.10 Differential equations
A differential equation is an equation involving derivatives. A differential equation of the form
f(y, y', y'', ╔) = 0
is called a homogenous differential equation. The general solution of a differential equation of the form
f(y, y', y'', ╔) = g(x)
is given by adding a function which solves the equation (a particular solution) to the general solution of the corresponding homogenous equation.
8.1.10.1 First order
y' + ay = 0 has the solution:
y(x) = Ce^(-ax)
where C is an arbitrary constant
y' + ay = b has the solution:
y(x) = b/a + Ce^(-ax)
y' + ay = f(x) has the solution:
y(x) = e^(-ax)(C + ║e^(ax)f(x) dx)
y' + y f(x) = g(x) has the solution:
y(x) = (G(x) + C)e^(-F(x))
where F(x) is a primitive function to f(x) and G(x) is a primitive function to g(x)e^F(x)
8.1.10.2 Second order
y'' + ay' + by = 0
has the characteristic equation
h^2 + ah + b = 0
with the roots h1 and h2
Ñ╩If h1 and h2 are real numbers, such that h1 ¡ h2, then the solution is given by:
y(x) = C1e^(h1x) + C2e^(h2x)
Ñ If h1 and h2 are real numbers, such that h1 = h2, then the solution is given by:
y(x) = e^(h1x)(C1x + C2)
Ñ If the function lacks real roots, the solution is given by:
y(x) = e^(-1/2 ax)(C1 cos kx + C2 sin kx)
where k = ├(-a^2/4 + b)
8.1.11 Geometry
8.1.11.1 Parallelogram
Sides a and b and height against a, h
Area = ah
Diagonals c and d, c^2 + d^2 = 2a^2 + 2b^2
8.1.11.2 Parallel trapezium
Parallel sides: a and b
Height: h
Area = h(a + b)/2
8.1.11.3 Circle
Radius: r
Diameter = 2r
Circumference = 2╣r
Area = ╣r^2
8.1.11.4 4 Circle sector
Radius: r
Central angle: a rad
Side = ar
Area = ar^2/2
8.1.11.5 Prism
Area: B
Height: h
Volume = Bh
8.1.11.6 Pyramid
Area: B
Height: h
Volume = Bh/3
8.1.11.7 Straight circular cylinder
Radius: r
Bottom disc area: ╣r^2
Cylindrical wall area: 2╣rh
Volume: ╣hr^2
8.1.11.8 Straight circular cone
Radius: r
Height: h
Side = ├(r^2 + h^2)
Surface area = ╣r├(r^2 + h^2)
Bottom disc area: ╣r^2
Volume = 1/3 ╣hr^2
8.1.11.9 Sphere
Radius: r
Area = 4╣r^2
Volume = 4╣r^3/3
8.1.12 Trigonometry
8.1.12.1 Pythagoras' theorem
If the length of the two perpendicular sides in a right angled are a and b and the length of the hypotenuse is c, the following relationship holds:
a^2 + b^2 = c^2
8.1.12.2 Definitions
Unit circle
-----------
Let c be a circle with centre in the origin and radius 1. Let r be a radius in the circle which makes angle º with the positive x-axis (positive angles are measured counter-clockwise). Let (x,y) be the point of intersection between r and c, we then have
sin º = y
cos º = x
Triangle
--------
In a right angled triangle, the sine of an angle is the length of the opposite side divided by the hypotenuse. The cosine of the angle is length of the adjacent side divided by the hypotenuse.
Other trigonometric functions
-----------------------------
tan º╩= sin º / cos º
cot º = cos º / sin º
sec º = 1 / cos º
csc º = 1 / sin º
8.1.12.3 The Triangle
Let a, b, c be the sides of a triangle and A, B, C be the angles facing the corresponding sides. Let T be the are of the triangle. We then have:
(The sine theorem)
sin A/a = sin B/b = sin C/c
(The cosine theorem)
a^2 = b^2 + c^2 - 2bc cos A
(The area theorem)
T = ab/2 sin C
8.1.12.4 Trigonometric Identities
(sin º)^2 + (cos º)^2 = 1
sin (º + ╢) = sin º cos ╢ + sin ╢ cos º
sin (º - ╢) = sin º cos ╢ - sin ╢ cos º
cos (º + ╢) = cos╩º cos ╢ - sin º sin╩╢
cos (º - ╢) = cos º cos ╢ + sin º sin ╢
tan (º + ╢) = (tan º + tan ╢)/(1 - tan╩º tan ╢)
tan (º - ╢) = (tan º - tan ╢)/(1 + tan╩º tan ╢)
sin º + sin ╢ = 2 sin((º + ╢)/2) cos((º - ╢)/2)
sin º - sin ╢ = 2 cos((º + ╢)/2) sin((º - ╢)/2)
cos º + cos ╢ = 2 cos((º + ╢)/2) cos((º - ╢)/2)
cos º - cos ╢ = -2 sin((º╩+ ╢)/2) sin((º - ╢)/2)
sin 2º = 2 sin º cos º
cos 2º = (cos º)^2 - (sin º)^2
= 2 (cos º)^2 - 1
= 1 - 2 (sin º)^2
tan 2º = 2 tan º/(1 - (tan º)^2)
sin 3º = 3 sin º - 4(sin º)^3
cos 3º = 4(cos º)^3 - 3 cos º
(sin (º/2))^2 = (1 - cos º)/2
(cos (º/2))^2 = (1 + cos º)/2
8.1.13 Sequences and series
8.1.13.1 Arithmetic sequence
In an arithmetic sequence the difference between a number and the next a constant, if the first number is a and the difference d, the sequence looks like:
a, a + d, a + 2d, a + 3d, a + 4d, a + 5d╔
The sum of an arithmetic series is given by:
s = t1 + t2 + ╔ + tn = n (t1 + tn)/2
8.1.13.2 Geometric sequence
In a geometric sequence the quotient between a number and the next is a constant. If the first number is a and the quotient k the sequence looks like:
a, ak, ak^2, ak^3, ak^4, ak^5╔
The sum of a geometric sequence is given by:
s = a + ak + ak^2 + ╔ + ak^(n-1) = a(k^n - 1)/(k - 1)
(Provided that k ¡1)
8.1.13.3 Convergence
A series is said to be convergent if the sums of the n first terms has a limit as n approaches infinity.
A geometric series is convergent if -1 < k < 1 and does in that case have the sum s = a/(1 - k).
8.1.14 Statistics
8.1.14.1 Concepts
Ñ A statistic material is a number of observations, in this document denoted by x1, x2, x3, x4, ╔ xn.
Ñ The frequency is the number of times a specific observation has occurred in the material.
Ñ╩The relative frequency is the quotient of the frequency and the number of observations (n).
Ñ If the material consists of real numbers it is divided in intervals.
Ñ╩The accumulated frequency is the number of observations less than or equal to a certain value.
Ñ The accumulated relative frequency is the quotient of the accumulated frequency and the number of observations
8.1.14.2 Mean, median, mode
The mean value is given by
_
x = (x1 + x2 + x3 + ╔╩+ xn)/n = 1/n ╖ xi
The median is the value above and below which there are an equal number of values. If the number of observations is even, the median is the mean of the two mid-values.
The mode is the value that has the highest frequency of the observed values.
8.1.14.3 Standard deviation
The standard deviation is given by:
s^2 = 1/(n-1) ╖ (xi - m)^2
= 1/n-1 (╖ (xi^2) - (╖ xi)^2/n)
where m is the mean value.
8.1.15 Probability
8.1.15.1 Basic Concepts
If p independent operations can be executed in n1, n2, n3, n4, ╔ np different ways, the total number of possibilities is:
N = n1 * n2 * n3 * ╔╩* np
The number of permutations of n element is given by:
n! = 1 * 2 * 3 * ╔╩* n
By definition, 0! = 1.
Among n elements, k can be selected in:
com(n, k) = n!/(k!(n-k)!) different ways.
8.1.15.2 Binomial distribution
If the chance of success of an experiment is p, the chance that exactly k experiments of n should be successful is:
com(n,k) p^k (1-p)^(n-k)
This is called binomial distribution. For this distribution the expected value u and the standard deviation o are given by:
u = np
o^2 = npq
8.1.15.3 The common frequency function
The frequency function for the normal distribution with expected value u and standard deviation o is given by:
f(x) = 1/(o├(2╣)) e^(-1/2 ((x - u)/o)^2)
With u = 0 and o = 1, we get the standardized common frequency function
f(x) := (1/├2╣) e^(-x^2/2);
8.1.15.4 Interval of confidence
From a normal distributed population with the mean value u and the standard deviation o an arbitrary sample of n elements and mean value x is taken. The following condition then holds with 95 % probability
x - 1.96 o/├n ▓ u ▓╩x + 1.96 o/├n
If 1.96 is changed to 2.58 the condition holds with 99 % probability.
8.2. Physics
8.2.1 Physical constants
Gravitational acceleration....... 9.8 m/s^2
Gas constant..................... 8.314 J/(mol K)
Atomic mass unit (u)............. 1.661E-27 kg = (931.5 MeV)
The following symbols will be used in this section:
m = mass
A = area
V = volume
s = distance
v = velocity
v0 = initial velocity
t = time
a = acceleration
g = acceleration in free fall
F = force
M = moment
I = impulse
W = work
P = power
8.2.2.1 Density
The density r is given by:
r = m/V
8.2.2.2 Pressure
The pressure p by a force F on a surface of area A is given by
p = F/A
The pressure p on the depth h in a fluid with density r is given by:
p = hgr
8.2.2.3 Velocity, acceleration
The average velocity, and the average acceleration:
v = s/t
a = v/t
The instantaneous velocity and acceleration:
v = ds/dt
a = dv/dt
8.2.2.4 Movement with constant acceleration
v = v0 + at
s = v0t + at^2/2
v^2 - v0^2 = 2as
8.2.2.5 Newton's second law of motion
F = ma
8.2.2.6 Moment
M = Fr
r is the perpendicular distance from the axis of revolution to the directional line of the force.
At equilibrium we have:
╖ M = 0
8.2.2.7 Newton's law of gravitation
F = GmM/r^2
m and M are the masses of the two bodies. r is the distance between them. G is the gravitational constant.
G = 6.672E-11 Nm^2/kg^2
8.2.2.8 Friction
F = uN
u = frictional coefficient
N = normal force
8.2.2.9 Throwing parabola
º = angle of elevation
vx = speed in x-direction
vy = speed in y-direction
vx = v0 cos º
vy = v0 sin º - gt
x = v0t cos º
y = v0t sin º - gt^2/2
8.2.2.10 Momentum
Momentum = mv
Change in momentum = impulse
I = Ft = mv - mv0
8.2.2.11 Centripetal force
r = radius
T = period
F = mv^2/r = 4╣^2mr/T^2
8.2.2.12 Harmonic motion
Harmonic motion is represented by the differential equation:
m d^2s/dt^2 = -ks
which is solved by:
s = A sin (wt + º)
A and º are constants. w is the angular speed, A is the amplitude and º is the phase angle.
w = ├(k/m)
T = 2╣├(m/k) (where T is the period)
For small oscillations in a pendulum, the following holds:
T = 2╣├(l/g)
8.2.2.13 Work, energy
W = Fs or W = ║F ds
(F is the force in the direction of the movement.)
Potential energy for a body with mass m on the height h above ground level:
W = mgh
Kinetic energy for a body of mass m moving at speed v:
W = mv^2/2
8.2.2.14 Power
P = W/t
(W is the change in energy during the time t.)
8.2.2.15 Straight central collision
mv + m'v' = mv0 + m'v0'
(Preservation of momentum)
v0 and v0' are the speeds before the collision
v and v' are the speeds after the collision
e = (v' - v)/(v0 - v0')
(e is the bouncing coefficient)
With e = 1 we get a completely elastic collision:
v' - v = v0 - v0'
With e = 0 we get a completely inelastic collision:
v = (mv0 + m'v0')/(m + m')
8.2.2.16 Hookes' law
F = ks
The elongation of a spring is proportional to the pulling force.
8.2.3 Proprieties of gases
The following symbols will be used in this section:
T = temperature (in íK)
p = pressure
V = volume
8.2.3.1 Boyle's law
pV = constant
(when the temperature is constant)
8.2.3.2 Charles' law
p = constant * T
(at constant volume)
8.2.3.3 Gay-Lussac's law
V = constant * T
(at constant pressure)
8.2.3.4 General gas law
pV = nRT
(n = number of mols,
R = gas constant = 8.314 J/(mol K))
r = p/p0 T0/T r0
(p0 = initial pressure - 101.3 kPa
T0 = initial temperature - 273 íK
r0 = initial density - density at 101.3 kPa, 273 íK)
8.2.3.5 Volume expansion of a gas at constant pressure
(V - V0)/(V0 (T - T0)) = 1/273 K^-1
(T - T0 = change in temperature)
8.2.3.6 Dalton's law
p = p1 + p2 + ╔
(p1, p2, ╔ = partial pressures)
8.2.3.7 Kinetic gas theory
m = the mass of one molecule of gas
N = the number of molecules
[v^2] = the average of the square of the velocities
[W] = the average of kinetic energy per molecule
r = density
p = 1/3 Nm[v^2]/V
pV = 1/3 Nm[v^2] = 2/3 N[W]
[v^2] = 3 p/r
[W] = 1/2 m[v^2] = 3/2 kT
(k is Boltzmann's constant = 1.381E-23 J/K
k = R/A, where R is the gas constant and A is Avogadro's constant)
8.2.4 Theory of heat
The heat capacity of a body = cm, where c is the specific heat capacity.
The change in heat energy of a body:
dQ = cm dT
8.2.5 Electronics I - Electrostatics, direct current
Symbols used in this section:
F force
Q electric charge
I electric current
t time
U voltage
W work, energy
K electric field
C capacitance
R resistance
r resistivity
E electromotive force, emf
P power
8.2.5.1 Coulomb's law
F = kqQ/r^2
The force between two charges q and Q at distance r. In vacuum the constant k is ┼ 8,99E9 Nm^2/(As)^2
8.2.5.2 Charge
Q = It
The charge delivered by a current I during the time t.
8.2.5.3 Voltage
U = W/Q
The voltage between two points equals the work required to transport a charge from one point to the other, divided by the charge's charge.
U = V1 - V2
The voltage between two points equals the difference in electric potential.
8.2.5.4 Electric Field Force
K = F/Q
The field force equals the force on a charge divided by the charge's charge.
The field force in a homogenous field between two charged parallel planes:
K = U/d
(U = voltage between the planes
d = distance between the planes)
8.2.5.5 Capacitance
C = Q/U
In the flat capacitor we have:
C = e A/d
(A = the area of one plane
d = the distance between the planes
e = the permittivity of the material)
1/C = 1/C1 + 1/C2 + ╔
(Connecting capacitors in series.)
C = C1 + C2 + ╔
(Connecting capacitors in parallel.)
The energy of an electrostatic field:
W = 1/2 CU^2 = 1/2 QU = 1/2 Q^2/C
8.2.5.6 Resistance
R = U/I
(Ohm's law)
R = r l/A
(The resistance in a wire of length l, cross-sectional area A and resistivity r.)
R = R1 + R2 + ╔
(Connecting resistors in series.)
1/R = 1/R1 + 1/R2 + ╔
(Connecting resistors in parallel.)
R = R0(1 + aT)
(The resistance of a material having resistance R0 at 0 íC at the temperature T íC.
a = temperature coefficient.)
8.2.5.7 Electrolytic battery
m = 1/F M/n It
(m = mass
M = molar mass
n = ion charge
t = time
F = Faraday's constant = 96487 As/mol)
8.2.5.8 Power and energy
The power in a wire subject to Ohm's law:
P = UI = RI^2 = U^2/R
The energy developed in the wire during the time t:
W = Pt
8.2.6 Electronics II Magnetism
The following symbols are used in this section.
B magnetic flux density
v velocity
─ magnetic flux
N number of wire loops
L inductance
8.2.6.1 Magnetic flux density
B = constant * f^2
f is the frequency of a magnetic material in harmonic motion about an equilibrium
8.2.6.2 Laplace's formula
A conducting element of length ╞l gives an addition ╞B to the flux density B in a point P on the distance r. In vacuum:
╞B = uI sin(a) ╞l/(4╣r^2)
a is the angle between the element and a line from the element to P.
u = 4╣ * 10^-7 is the permeability of vacuum.
I is the current through the conductor.
The magnetic flux density on distance d of a straight conductor of infinite length in vacuum:
B = 2uI/(4╣d)
The magnetic flux density at the midpoint of a flat circular coil of radius r:
B = uNI/(2r)
The magnetic flux density in a toroid or solenoid
B = uNI/l
u is the permeability of the material inside the solenoid.
l is the length of the solenoid.
The permeability of air roughly equals the permeability of vacuum.
8.2.6.3 Magnetic flux
With a constant flux density B perpendicular to an area A, the magnetic flux through the area is given by:
─ = BA
8.2.6.4 Force between magnetic fields and charges in motion
F = IlB
l is the length of the conductor in a field perpendicular to the conductor.
F = QvB
When the charged particle is moving perpendicularly to the field direction.
8.2.6.5 Electromagnetic induction
For the induced current e in a closed circuit where N is the number of loops and ─ is the magnetic flux through the circuit:
e = -N d─/dt
For a conductor of length l moved perpendicularly to a magnetic field of magnetic flux density B, where v is the velocity of the conductor:
e = lvB
For self-induction in a solenoid:
e = -L di/dt
L is the inductance of the solenoid.
The energy of a magnetic field inside a solenoid:
W = 1/2 Li^2
8.2.7 Electronics III. Alternating current.
(All formulas in this section refer to a sine-shaped current.)
The following symbols will be used in this section:
i, u momentary current and voltage
ö, ₧ amplitudes for current and voltage
I, U effective values for current and voltage
w angular frequency
f frequency
t time
P average power
Z impedance
8.2.7.1 Basics
Momentary values for current and voltage are found by:
u = ₧ sin (wt + a)
i = ö sin (wt + b)
a and b are phase angles
w = 2╣f
f = 1/T
T is the period
i = dQ/dt
For the phase lag of the current and the voltage:
─ = a - b
U = ₧/├2
I = ö/├2
With solely resistive load:
i = ö sin wt
u = ₧ sin wt
ö = ₧/R
With solely inductive load:
i = ö sin wt
u = ₧ sin (wt + ╣/2)
₧ = wLö
wL is the inductive reactance
With solely capacitive load:
i = ö sin wt
u = ₧ sin (wt - ╣/2)
₧ = ö/(WC)
1/(WC) is the capacitive reactance
8.2.7.2 Impedance and phase lag
Impedance of a load:
Z = ₧/ö = U/I
LRC - circuit in series:
Z = ├(R^2 + (wL - 1/(wC)^2)
tan ─ = (wL - 1/(wC))/R
LRC - circuit in parallel
Z = 1/(├(1/R^2 + (1/(wL) - wC)^2))
tan ─ = R(1/(wL) - wC)
8.2.7.3 Resonance
Resonance in a connection in series of an R, an L and a C component appears when:
w = 1/├(LC)
Then the impedance is given by R.
8.2.7.4 Power
The average power P in a load is given by:
P = UI cos ─
8.2.7.5 Transformer
For an ideal transformer we have:
u/U = n/N
ni = NI
n, N number of loops in primary and secondary coil respectively
u, U effective voltage values across primary and secondary coil
i, I effective current through primary and secondary coil
8.2.7.6 Electronic oscillator
In an electronic oscillator with inductance L, capacitance C and resistance 0, we have:
L d^2i/dt^2 + i/C = 0
This differential equation is satisfied by:
i = ö sin wt, where w = 1/├(LC)
T = 2╣├(LC)
8.2.8 Optics
The following symbols are used in this section:
─ light flux
I light strength
E illumination
A area
l distance from light source to illuminated area
ë angle between light and surface normal
a distance from object to mirror or lens
b distance from picture to mirror or lens
r radius of curved surface
f focal length
n index of refraction
º angle of refraction
╢ angle of deviation
c light speed in vacuum
v light speed in a medium
8.2.8.1 Photometrics
─ = 4╣I
E = ─/A
E = I cos ë /l^2
8.2.8.2 Spherical mirrors
1/a + 1/b + 1/f = 2/r
dD = f^2
d = distance from object to focus
D = distance from picture to focus
8.2.8.3 Law of refraction
n sin ë = m sin ₧
m, ₧ = index of refraction and angle of refraction in the second medium
8.2.8.4 Index of refraction
n = c/v
8.2.8.5 Minimum deviation in prism
n sin ((º + ╢)/2) = m sin (º/2)
º = top angle of prism
╢ = angle of deviation
n = index of refraction outside prism
m = index of refraction inside prism
8.2.8.6 Thin lenses
1/a + 1/b = 1/f
dD = f^2
d = distance from object to object focus
D = distance from image to image focus
8.2.9 Wave theory
The following symbols are used in this section:
v speed of propagation
f frequency
l wave length
T period
t time
8.2.9.1 Basics
v = lf
f = 1/T
8.2.9.2 Doppler effect
f = emitted frequency
g = observe frequency
c = speed of propagation
Source at rest, observer approaching with velocity v:
g = f(1 + v/c)
Source at rest, observer withdrawing with velocity v:
g = f(1 - v/c)
Observer at rest, source approaching with speed v:
g = f/(1 - v/c)
Observer at rest, source withdrawing with velocity v:
g = f/(1 + v/c)
8.2.9.3 Speed of sound
v = u├(T/273)
T = temperature
u = speed at T = 273
8.2.10 Electromagnetic radiation
The following symbols are used in this section:
M emissivity
T absolute temperature
l wavelength
8.2.10.1 Stefan-Boltzmann's law
M = sT^4
where s = 56.70 nW/(m^2K^4)
8.2.10.2 Wien's displacement law
lT = 2898 umK
l = wavelength with maximum energy
8.2.10.3 Diffraction grating
ml = d sin a
m = order of interference fringe
d = distance between two lines in diffraction grating
a = angle of deviation
8.2.11 Nuclear physics
The following symbols are used in this section:
h Planck's constant = 6.626 * 10^-34 Js
W energy
f frequency
l wavelength
m mass
v velocity
c light speed in vacuum
U voltage
e charge of electron
8.2.11.1 Planck's law
W = hf
8.2.11.2 Photoelectric effect
hf = W + mv^2/2
hf = W + eU
W = work of emission
8.2.11.3 de Broglie's formula
l = h/(mv)
8.2.11.4 Radioactive decay
N = Me^(-kt)
M = original mass
N = mass at time t
k = a constant
e = base of system of natural logarithms, 2.718╔
8.2.11.5 Theory of relativity
W = mc^2
m = M/├(1 - v^2/c^2)
l = L├(1 - v^2/c^2)
M = mass at rest
L = length at rest
8.3. Chemistry
8.3.1 Chemical equilibrium
For the chemical equilibrium aA + bB <-> cC + dD, we have
[C]^c*[D]^d/([A]^a*[B]^b) = C
Where C is a constant.
8.3.2 Acids and bases
Acid constant for the acid HA:
K = [H30+] * [A-] / [HA]
Base constant for the base A-:
K = [HA] * [OH-] / [A-]
pH = -lg[H30+]
pOH = -lg[OH-]
[H30+] * [OH-] = K ┼ 1E-14 (mol/dm^3)^2
pH + pOH = pK ┼ 14
K(a) + K(b) = K = 1E-14
K(a) = acid constant
K(b) = base constant
8.4. Economics
8.4.1 Interest
The value of the deposit d with p % interest after t years:
d(1 + p/100)^t
The value of an annual deposit d with p % interest after t years.
d((1 + p/100)^t -1)/(p/100)
A loan l to an interest of p % is paid back with equal amounts in t years. The necessary amount is given by:
l((1 + p/100)^t*p/100)/((1 + p/100)^t -1)
A deposit to an interest of p % will have the value v in t years, the current value is given by:
v/(1 + p/100)^t
9. Error Codes
9.1. Acsc value not defined
This error will appear when you try to calculate the arccosecant of a value for which the function is not defined.
9.2. Arccosine argument not between -1 and 1
This error will appear if you try to calculate acos() of a value that is not between -1 and 1, since acos is only defined for values in the interval [-1, 1]. acos(2).
9.3. Arcsine argument not between -1 and 1
This error will appear if you try to calculate asin() of a value that is not between -1 and 1, since asin is only defined for values in the interval [-1, 1]. asin(2).
9.4. Asec value not defined
This error will appear when you try to calculate the arcsecant of a value for which the function is not defined.
9.5. Cot value not defined
This error will appear when you try to calculate the cotangent of a value for which the function is not defined.
9.6. Csc value not defined
This error will appear when you try to calculate the cosecant of a value for which the function is not defined.
9.7. Division by complex zero
This error will appear if you try to make a complex division with a complex zero. (2, 3) /' (0, 0).
9.8. Division by zero
This error will appear if you try to divide a number by zero. 5 / 0.
9.9. Else without if
This error will appear if the computer finds an else statement without a preceding if statement, since such expressions are meaningless.
9.10. End without while or if
This error will appear if you have used and end statement without a preceding if or while statement, since such expressions are meaningless.
9.11. Expression too complex
This error will appear in the rare occasion that your expression has become too complex for the computer to understand. Try splitting up a long statement to several smaller statements.
9.12. Function lacking arguments
This error will appear if you have passed to few arguments to a function for example calling: angle(3); would raise this error, since angle() requires two arguments.
9.13. Function name too long
This error will appear if you have used a function name which is longer than 30 characters. None of the functions that the calculator recognizes are so long, so this should generally be a typing error.
9.14. Function nesting too complex
This error will appear if there are too many while statements inside each other. Try breaking up the structure to prevent too deep nesting.
9.15. Interrupted by user
This error will appear if you interrupt program execution or graph-drawing by pressing the command key together with the period. This is useful if you have written a while statement that fails to terminate.
9.16. Invalid arithmetic sum
This error will appear if the three arguments sent to the arit() function can't possibly be the first second and last terms of an arithmetic sum. arit(1,0,3) will raise this error.
9.17. Invalid geometric sum
This error will appear if the three arguments passed to the geom() function can't possibly be the first second and last terms of a geometric sum. geom (1,1,4) will raise this error.
9.18. Modulo zero
This error will appear if you try to take modulo zero. Writing 4 % 0 will raise this error.
9.19. Number or text used where variable is required
This error will appear if you have used a number or text where the computer expected a variable. Writing 3 := 5 will raise this error.
9.20. Passing non-text arguments to a function which requires text arguments
This error will appear when you try to pass a number or a variable to a function that requires text arguments. message(2+3), will raise this error.
9.21. Program too long
This message means that your program has exceeded the 1000 memory cells that are reserved for program. If this happens there is not much to do, but to realise that your program has become too complex for this humble calculator. If you need to write the program, consider getting a "real" programming language.
9.22. Raising negative number to fraction exponents
This error will appear if you try to raise a negative number to a fraction exponent, since this is equivalent to trying to take a root of a negative value. (-2) ^ 0.5.
9.23. Raising zero to negative exponent
This error will appear if you try to raise zero to a negative exponent, since this is equivalent to dividing by zero. 0 ^ -2.
9.24. Sec value not defined
This error will appear when you try to calculate the secant of a value for which the function is not defined.
9.25. Trying to calculate logarithm of negative value or zero
This error will appear if you try to calculate the logarithm of a negative value or zero, since logarithms are not defined for these values. log(-1).
9.26. Trying to invert zero
This error will appear if you try to invert zero. inv(0).
9.27. Trying to permute negative value
This error will appear if you try to permute a negative value. (-1)!
9.28. Trying to read beyond memory
This error will appear if you refer to a memory cell other than the 100 that is available, that is, if the argument passed to mem is smaller than 0 or bigger than 99. mem(101).
9.29. Trying to take root of negative value
This error will appear if you try to take the root of a negative value. ├-1.
9.30. Trying to take tangent of odd multiple of ╣/2
This error will appear if you try to take tangent of an odd multiple of ╣/2, since tangent is not defined for these values. tan(3╣/2).
9.31. Trying to use 1, 0 or a negative number as base for a logarithm
This error will appear, because these numbers cannot be used as bases for logarithms.
9.32. Unknown character used
This error will appear if you have used a character that the calculator doesn't know of, like î, è or Ü, outside a string.
9.33. Unknown character combination used
This error will appear if you have used characters that the calculator know of, but grouped them in some strange fashion. Writing 3 >* 3 will raise this error.
9.34. Unknown function used
This error will appear if you have used a function that the calculator doesn't know of, like DrawSphere(). If you get this error check for typing mistakes. Remember that the calculator bothers about the case of a word, so although there is a function FRect(), it will not recognize fRect().
9.35. Unrecognized function
This error will appear if you have used a function that the computer doesn't recognize, like drawSphere().
9.36. Value returned by sinh too large
This error will appear if you pass a too big value to sinh.
9.37. Value returned by cosh too large
This error will appear if you pass a too big value to cosh.
10. Technical Information
10.1. How the calculator works
The calculator gets it results from a two step process.
In the first step the actual text that the user has written is transformed to a stack of entries compiled using reverse polish notation. This step can be called compilation, remembering, though, that the text is not compiled to machine language, but to a simpler form.
The next step might be called interpretation. The computer then uses the code created by the previous step and executes each function as it encounters it. When the computer reaches the end of the code the program terminates.
10.2. Text to reverse polish notation
In pseudocode (extremely pseudo), this process might look like this:
1. Look at each character in the input string
2a. If the character is a number
(Read the number and push it to the RPN stack.)
2b. If the character is a function
(Read the function and push it to the command stack. If the previous entries in the command stack are of higher precedence, taking in account of course any parentheses, than this entry, pop them from the command stack and push them to the RPN stack.)
3. Continue until the entire input string has been examined, then pop all entries from the command stack and push them to the RPN stack.
If the input string is: (3 + 2) * (4 + 6), what will happen is this:
1. The computer reads 3 and pushes it to the RPN stack.
RPN stack: 3
Command stack:
2. The computer reads + (at parentheses-level 1) and pushes it to the command stack, there are no previous entries to be popped.
RPN stack: 3
Command stack: +(1)
3. The computer reads 2 and pushes it to the RPN stack.
RPN stack: 3 2
Command stack: +(1)
4. The computer reads * (at parentheses-level 0) and pushes it to the command stack, since +(1) is of higher precedence (because of the higher level of parentheses) it is popped from the command stack and pushed to the RPN stack.
RPN stack: 3 2 +
Command stack: *(0)
5. The computer reads 4 and pushes it to the RPN stack.
RPN stack: 3 2 + 4
Command stack: *(0)
6. The computer reads +(1), since this is of higher level than *(0), *(0) remains at the command stack.
RPN stack: 3 2 + 4
Command stack: *(0) +(1)
7. The computer reads 6, and pushes it to the RPN stack.
RPN stack: 3 2 + 4 6
Command stack: *(0) +(1)
8. The computer reaches the end of the string, pops all entries from the command stack and pushes them to the RPN stack.
RPN stack: 3 2 + 4 6 + *
Command stack:
And that's it!
10.3. About reverse polish notation
Reverse Polish Notation (RPN) is a notation that makes it possible to write any mathematical expression without parentheses. (RPN is the native language of the programming language Forth.)
An expression in reverse polish notation might look something like this:
3 2 + 4 6 + *
When an expression in reverse polish notation is evaluated any encountered numbers are pushed to a stack (that we might call the result stack). When a function is encountered it pops as many arguments as it needs from the result stack, performs whatever operation it should perform on this arguments and pushes the result back to the result stack.
If the example expression above was interpreted, this is what would happen:
1. The computer reads 3, it is pushed to the result stack.
Result stack: 3
2. The computer reads 2, it is pushed to the result stack.
Result stack: 3 2
3. The computer reads +. This function needs two arguments, so it pops 2 and 3 from the stack, performs its operation (2 + 3). And pushes the result (5) to the stack.
Result stack: 5
4. The computer reads 4 and pushes it to the result stack.
Result stack: 5 4
5. The computer reads 6 and pushes it to the result stack.
Result stack: 5 4 6
6. The computer reads +. This functions needs two arguments so it pops 6 and 4 from the stack, performs its operation (4 + 6) and pushes the result (10) to the stack.
Result stack: 5 10
7. The computer reads *. 5 and 10 are popped from the stack and (5 * 10 = 50) is pushed to the stack.
Result stack: 50
The final value of the result stack is the searched value. If you think of it, you will realise that 3 2 + 4 6 + * is in fact equal to (3 + 2) * (4 + 6) in ordinary notation.
The calculator will understand RPN if you use commas to delimit the separate entries, that is you may write (3 + 2) * (4 + 6) as 3, 2, +, 4, 6, +, *.
11. Table of Content
1. General Instructions
1.1. About this program
1.2. How to use it
1.3. How to learn using the calculator
1.4. General editing instructions
1.5. Using multiple calculators
2. The Menu Options
2.1. The Apple menu
2.2. The File menu
2.3. The Edit menu
2.4. The Calculator menu
2.5. Calculator specific menus
3. The Layman's Calculator
3.1. The window
3.2. Entering an expression
3.3. Using the results of calculations
4. The Scientific Calculator
4.1. The window
4.2. Using complex numbers
4.3. Using variables
4.3.1 Variables available
4.3.2 Storing something in a variable
4.3.3 Using a variable's value
4.4. Doing multiple calculations
4.5. Using reverse polish notation
5. The Graph Drawer
5.1. The window
5.2. The Graph menu
5.3. Ordinary graphs
5.4. Polar graphs
5.5. Parametric graphs
5.6. Zooming and scrolling
5.7. Finding intersections
5.8. Numerical differentiation
5.9. Numerical integration
6. The Programmable Calculator
6.1. The window
6.2. The Programmable menu
6.3. General editing instructions
6.4. Programming vs. calculation
6.5. Using variables
6.5.1 Variables available
6.5.2 Storing something in a variable
6.5.3 Using a variable's value
6.6. Controlling program flow
6.6.1 The if - else - end construction
6.6.2 The while-end construction
6.7. Comparison of control functions
6.7.1 goto
6.7.2 gosub, functions
6.7.3 else if
6.7.4 switch, case
6.7.5 for, next
6.8. Getting data from the user
6.8.1 Getting Data From Dialogs
6.8.2 Getting Data From The Mouse
6.9. Displaying data to the user
6.10. Presenting data in dialogs
6.11. Presenting data in a graphic window
6.12. Sample programs
6.12.1 Guessing game
6.12.2 Mirror drawer
7. Function Reference
7.1. Function glossary
7.2. Complex
7.3. Dialogs
7.4. Drawing
7.5. Economic functions
7.6. Exponential functions
7.7. Integer
7.8. Logical functions
7.9. Memory functions
7.10. Mouse functions
7.11. Printing text and numbers
7.12. Program flow
7.13. Real-value
7.14. Sign functions
7.15. Time functions
7.16. Trigonometric
7.17. Window functions
8. Formulas
8.1. Mathematics
8.1.1 Fundamental algebraic laws
8.1.2 Approximations
8.1.3 Algebra
8.1.3.1 Quadratic laws, binomial theorem
8.1.3.2 Solving Quadratic Equations
8.1.3.3 Fundamental Theorem of Algebra
8.1.4 Logarithms and Exponents
8.1.4.1 Laws for Exponents
8.1.4.2 Definition of Logarithms
8.1.4.3 Logarithm Laws
8.1.5 Analytical geometry
8.1.5.1 Midpoints
8.1.5.2 Distances
8.1.5.3 Scalar Product
8.1.5.4 Vector length
8.1.5.5 Angle between vectors
8.1.5.6 Straight Lines
8.1.6 Calculus
8.1.6.1 Increasing/Decreasing Functions
8.1.6.2 Local maximum and minimum
8.1.6.3 Derivative of Function
8.1.6.4 Finding Maximum and Minimum
8.1.6.5 Determining concavity
8.1.6.6 Mean Value Theorem
8.1.7 Rules of Differentiation
8.1.7.1 Arithmetic Operations
8.1.7.2 Common derivatives
8.1.8 Integrals
8.1.8.1 Primitive functions
8.1.8.2 Rules of Integration
8.1.8.3 Common Integration Methods
8.1.8.4 Some primitive functions
8.1.9 Conics
8.1.10 Differential equations
8.1.10.1 First order
8.1.10.2 Second order
8.1.11 Geometry
8.1.11.1 Parallelogram
8.1.11.2 Parallel trapezium
8.1.11.3 Circle
8.1.11.4 Circle sector
8.1.11.5 Prism
8.1.11.6 Pyramid
8.1.11.7 Straight circular cylinder
8.1.11.8 Straight circular cone
8.1.11.9 Sphere
8.1.12 Trigonometry
8.1.12.1 Pythagora's theorem
8.1.12.2 Definitions
8.1.12.3 The Triangle
8.1.12.4 Trigonometric Identities
8.1.13 Sequences and series
8.1.13.1 Arithmetic sequence
8.1.13.2 Geometric sequence
8.1.13.3 Convergence
8.1.14 Statistics
8.1.14.1 Concepts
8.1.14.2 Mean, median, mode
8.1.14.3 Standard deviation
8.1.15 Probability
8.1.15.1 Basic Concepts
8.1.15.2 Binomial distribution
8.1.15.3 The common frequency function
8.1.15.4 Interval of confidence
8.2. Physics
8.2.1 Physical constants
8.2.2 Mechanics
8.2.2.1 Density
8.2.2.2 Pressure
8.2.2.3 Velocity, acceleration
8.2.2.4 Movement with constant acceleration
8.2.2.5 Newton's second law of motion
8.2.2.6 Moment
8.2.2.7 Newton's law of gravitation
8.2.2.8 Friction
8.2.2.9 Throwing parabola
8.2.2.10 Momentum
8.2.2.11 Centripetal force
8.2.2.12 Harmonic motion
8.2.2.13 Work, energy
8.2.2.14 Power
8.2.2.15 Straight central collision
8.2.2.16 Hookes' law
8.2.3 Proprieties of gases
8.2.3.1 Boyle's law
8.2.3.2 Charles' law
8.2.3.3 Gay-Lussac's law
8.2.3.4 General gas law
8.2.3.5 Volume expansion of a gas at constant pressure
8.2.3.6 Dalton's law
8.2.3.7 Kinetic gas theory
8.2.4 Theory of heat
8.2.5 Electronics I - Electrostatics, direct current
8.2.5.1 Coulomb's law
8.2.5.2 Charge
8.2.5.3 Voltage
8.2.5.4 Electric Field Force
8.2.5.5 Capacitance
8.2.5.6 Resistance
8.2.5.7 Electrolytic battery
8.2.5.8 Power and energy
8.2.6 Electronics II Magnetism
8.2.6.1 Magnetic flux density
8.2.6.2 Laplace's formula
8.2.6.3 Magnetic flux
8.2.6.4 Force between magnetic fields and charges in motion
8.2.6.5 Electromagnetic induction
8.2.7 Electronics III. Alternating current.
8.2.7.1 Basics
8.2.7.2 Impedance and phase lag
8.2.7.3 Resonance
8.2.7.4 Power
8.2.7.5 Transformer
8.2.7.6 Electronic oscillator
8.2.8 Optics
8.2.8.1 Photometrics
8.2.8.2 Spherical mirrors
8.2.8.3 Law of refraction
8.2.8.4 Index of refraction
8.2.8.5 Minimum deviation in prism
8.2.8.6 Thin lenses
8.2.9 Wave theory
8.2.9.1 Basics
8.2.9.2 Doppler effect
8.2.9.3 Speed of sound
8.2.10 Electromagnetic radiation
8.2.10.1 Stefan-Boltzmann's law
8.2.10.2 Wien's displacement law
8.2.10.3 Diffraction grating
8.2.11 Nuclear physics
8.2.11.1 Planck's law
8.2.11.2 Photoelectric effect
8.2.11.3 de Broglie's formula
8.2.11.4 Radioactive decay
8.2.11.5 Theory of relativity
8.3. Chemistry
8.3.1 Chemical equilibrium
8.3.2 Acids and bases
8.4. Economics
8.4.1 Interest
9. Error Codes
9.1. Acsc value not defined
9.2. Arccosine argument not between -1 and 1
9.3. Arcsine argument not between -1 and 1
9.4. Asec value not defined
9.5. Cot value not defined
9.6. Csc value not defined
9.7. Division by complex zero
9.8. Division by zero
9.9. Else without if
9.10. End without while or if
9.11. Expression too complex
9.12. Function lacking arguments
9.13. Function name too long
9.14. Function nesting too complex
9.15. Interrupted by user
9.16. Invalid arithmetic sum
9.17. Invalid geometric sum
9.18. Modulo zero
9.19. Number or text used where variable is required
9.20. Passing non-text arguments to a function which requires text arguments
9.21. Program too long
9.22. Raising negative number to fraction exponents
9.23. Raising zero to negative exponent
9.24. Sec value not defined
9.25. Trying to calculate logarithm of negative value or zero
9.26. Trying to invert zero
9.27. Trying to permute negative value
9.28. Trying to read beyond memory
9.29. Trying to take root of negative value
9.30. Trying to take tangent of odd multiple of ╣/2
9.31. Trying to use 1, 0 or a negative number as base for a logarithm